<template>
  <div>
    <!-- 信息展示 -->
    <Card>
      <!-- 头部的件数统计 -->
      <div class="top top-self">
        <div class="col-25 bd-r">
          <div class="info">本月交费完成</div>
          <div class="infoNum">{{ pay }}个</div>
        </div>
        <div class="col-25 bd-r">
          <div class="info">剩余未交费</div>
          <div class="infoNum">{{ nopay }}个</div>
        </div>
        <div class="col-25 bd-r">
          <div class="info">
            即将失效保单
            <Tooltip content="宽限期在45-65天内的保单" placement="top">
              <Icon type="ios-alert-outline" style="color:#000" />
            </Tooltip>
          </div>
          <div class="infoNum">{{ willInvalid }}个</div>
        </div>
        <div class="col-25">
          <div class="info">
            本月困难件
            <Tooltip content="保单交费难度大于等于8级" placement="top">
              <Icon type="ios-alert-outline" style="color:#000" />
            </Tooltip>
          </div>
          <div class="infoNum">{{ difficult }}个</div>
        </div>
      </div>
      <div class="clearBoth"></div>
    </Card>
    <!-- 表单填写 -->
    <Card style="margin-top:20px;margin-bottom:20px;">
      <Form :model="superviseForm" ref="superviseForm" :rules="rules" style="display: block;">
        <Row gutter="40">
          <i-col span="6">
            <FormItem>
              <Select v-model="superviseForm.workStatus" placeholder="工作状态" clearable>
                <Option v-for="item in workStatusList" :key="item.key" :value="item.key">{{ item.value }}</Option>
              </Select>
            </FormItem>
          </i-col>
          <i-col span="6">
            <FormItem>
              <DatePicker v-model="superviseForm.workPlanRange" type="daterange" placeholder="工作计划时间段" :editable="false"
                style="width:100%" @on-change="changeWorkPlanRange"></DatePicker>
            </FormItem>
          </i-col>
          <i-col span="6">
            <FormItem>
              <DatePicker v-model="superviseForm.workEndRange" type="daterange" placeholder="工作完成时间段" :editable="false"
                style="width:100%" @on-change="changeWorkEndRange"></DatePicker>
            </FormItem>
          </i-col>
          <i-col span="6">
            <FormItem>
              <DatePicker v-model="superviseForm.PayableRange" type="daterange" placeholder="应交日时间段" :editable="false"
                style="width:100%" @on-change="changePayableRange"></DatePicker>
            </FormItem>
          </i-col>
        </Row>
        <Row gutter="40">
          <i-col span="6">
            <FormItem>
              <Select v-model="superviseForm.saleChannel" @on-change="changeSaleChannel" placeholder="销售渠道" clearable>
                <Option v-for="item in saleChannelList" :key="item.key" :value="item.key">{{ item.value }}</Option>
              </Select>
            </FormItem>
          </i-col>
          <i-col span="6">
            <FormItem>
              <Select v-model="superviseForm.subname" :disabled="!superviseForm.saleChannel" placeholder="子渠道" clearable>
                <Option v-for="item in subnameList" :key="item.value" :value="item.value">{{ item.value }}</Option>
              </Select>
            </FormItem>
          </i-col>
          <i-col span="6">
            <FormItem>
              <Input placeholder="投保人姓名" v-model="superviseForm.appntName" />
            </FormItem>
          </i-col>
          <i-col span="6">
            <FormItem>
              <Input placeholder="保单号" v-model="superviseForm.applyNo" />
            </FormItem>
          </i-col>
          <!-- <i-col span="6">
            <Row>
              <i-col span="11">
                <FormItem>
                  <Input placeholder="应交次数" v-model="superviseForm.payCount" />
                </FormItem>
              </i-col>
              <i-col span="2" style="text-align:center;line-height:30px">-</i-col>
              <i-col span="11">
                <FormItem>
                  <Select v-model="superviseForm.pay" clearable>
                    <Option v-for="item in payList" :key="item.key" :value="item.key">{{item.value}}</Option>
                  </Select>
                </FormItem>
              </i-col>
            </Row>
          </i-col> -->

          <!-- <Select v-model="form1.chargeStatus" clearable>
              <Option v-for="item in estimatestate" :key="item.key" :value="item.key">{{item.value}}</Option>
            </Select> -->

        </Row>
        <Row gutter="40">
          <i-col span="6">
            <FormItem>
              <Select v-model="superviseForm.estimatestate" placeholder="收费预估" clearable>
                <Option v-for="item in estimatestateList" :key="item.key" :value="item.key">{{ item.value }}</Option>
              </Select>
            </FormItem>
          </i-col>
          <i-col span="6">
            <FormItem>
              <Cascader change-on-select :data="organizationList" v-model="superviseForm.reagentOrganization"
                @on-change="organizationChange" placeholder="续期专员机构" clearable></Cascader>
            </FormItem>
          </i-col>
          <i-col span="6">
            <FormItem>
              <Select v-model="superviseForm.reagentName" placeholder="续期专员姓名" clearable multiple>
                <Option v-for="item in reagentNameList" :key="item.key" :value="item.key">{{ item.value }}-{{ item.key }}
                </Option>
              </Select>
            </FormItem>
          </i-col>
          <i-col span="6">
            <FormItem>
              <Select v-model="superviseForm.contMark" placeholder="保单标志" clearable>
                <Option value="0">在职单</Option>
                <Option value="1">孤儿单</Option>
              </Select>
            </FormItem>
          </i-col>
        </Row>
        <Row gutter="40">
          <i-col span="6">
            <Row>
              <i-col span="11">
                <FormItem prop="minFee">
                  <Input placeholder="最低应收保费" v-model="superviseForm.minFee" type="number"
                    @on-blur="decimalConversion(superviseForm.minFee)" />
                </FormItem>
              </i-col>
              <i-col span="2" style="text-align:center;line-height:30px">-</i-col>
              <i-col span="11">
                <FormItem prop="maxFee">
                  <Input placeholder="最高应收保费" v-model="superviseForm.maxFee" type="number"
                    @on-blur="decimalConversion2(superviseForm.maxFee)" />
                </FormItem>
              </i-col>
            </Row>
          </i-col>
          <i-col span="6">
            <FormItem>
              <Cascader change-on-select :data="organizationAgentList" v-model="superviseForm.organization"
                placeholder="业务员机构" clearable></Cascader>
            </FormItem>
          </i-col>
          <i-col span="6">
            <FormItem>
              <Input placeholder="业务员姓名" v-model="superviseForm.salesName" />
            </FormItem>
          </i-col>
          <i-col span="6">
            <FormItem>
              <Select v-model="superviseForm.payDifficult" placeholder="交费难度" clearable>
                <Option v-for="item in 11" :key="item - 1" :value="item - 1">{{ item - 1 }}级</Option>
              </Select>
            </FormItem>
          </i-col>
        </Row>
        <Row gutter="40">
          <i-col span="6">
            <FormItem>
              <DatePicker v-model="superviseForm.shouldPayRange" type="daterange" placeholder="工作录入时间段" :editable="false"
                style="width:100%" @on-change="changeShouldPayRange"></DatePicker>
            </FormItem>
          </i-col>
          <i-col span="6">
            <FormItem>
              <Select v-model="superviseForm.faceflag" placeholder="是否面访" clearable>
                <Option value="0">是</Option>
                <Option value="1">否</Option>
              </Select>
            </FormItem>
          </i-col>
          <i-col span="6">
            <FormItem>
              <Select v-model="superviseForm.visitresult" placeholder="是否外呼成功" clearable>
                <Option value="0">是</Option>
                <Option value="1">否</Option>
              </Select>
            </FormItem>
          </i-col>
          <i-col span="6">
            <FormItem>
              <Select v-model="superviseForm.evaluateflag" placeholder="是否上传评鉴表" clearable>
                <Option value="Y">是</Option>
                <Option value="N">否</Option>
              </Select>
            </FormItem>
          </i-col>
        </Row>
        <Row style="margin-bottom:10px" gutter="40">
          <i-col span="6">
            <FormItem>
              <Select v-model="superviseForm.payWay" placeholder="交费方式" @on-change="changePayWay" clearable>
                <Option v-for="item in payWayList" :key="item.key" :value="item.key">{{ item.value }}</Option>
              </Select>
            </FormItem>
          </i-col>
          <i-col span="6">
            <Row>
              <i-col span="11">
                <FormItem prop="beginTime">
                  <Input placeholder="应交日开始天数" v-model="superviseForm.beginTime" type="number" />
                </FormItem>
              </i-col>
              <i-col span="2" style="text-align:center;line-height:30px">-</i-col>
              <i-col span="11">
                <FormItem prop="endTime">
                  <Input placeholder="应交日结束天数" v-model="superviseForm.endTime" type="number" />
                </FormItem>
              </i-col>
            </Row>
          </i-col>
        </Row>
        <Row>
          <Button type="primary" @click="handleSubmit()" style="margin-right:20px" :loading="queryLoading">查询</Button>
          <Button @click="handleReset()">重置</Button>
        </Row>
      </Form>
    </Card>
    <!-- 表格信息 -->
    <Card>
      <div style="display:flex;justify-content:space-between">
        <div class="content">
          <Button :type="but[0]" @click="clickButton(0)">全部</Button>
          <Button :type="but[1]" @click="clickButton(1)">本月完成</Button>
          <Button :type="but[2]" @click="clickButton(2)">超期计划</Button>
          <Button :type="but[3]" @click="clickButton(3)">即将失效</Button>
          <Button :type="but[4]" @click="clickButton(4)">困难件</Button>
          <Button :type="but[5]" @click="clickButton(5)">大额件</Button>
        </div>
        <div>
          <Button type="primary" icon="md-download" @click="downLoad">导出数据</Button>
        </div>
      </div>
      <Table :columns="superviseColumns" :row-class-name="rowClassName" :data="superviseData"
        @on-selection-change="selectionChange" @on-sort-change="sortChange">
        <template slot-scope="{row}" slot="planstatename">
          <span v-if="row.planstatename == '未服务'">
            <Button style="border-radius: 16px;background-color:rgb(255,141,26);color:#fff" size="small"
              @click="forward(row)">{{ row.planstatename }}</Button>
          </span>
          <span v-if="row.planstatename == '服务中'">
            <Button style="border-radius: 16px;background-color:rgb(24,144,255);color:#fff" size="small"
              @click="forward(row)">{{ row.planstatename }}</Button>
          </span>
          <span v-if="row.planstatename == '已完成'">
            <Button style="border-radius: 16px;background-color:rgb(67,207,124);color:#fff" size="small"
              @click="forward(row)">{{ row.planstatename }}</Button>
          </span>
        </template>
      </Table>
      <Page :total="total" show-sizer show-total style="text-align:right;margin-top:20px" @on-change="pageChange"
        @on-page-size-change="pageSizeChange" :page-size-opts="pageSizeOptions" :current="pageIndex" :page-size="pageSize"
        transfer></Page>
    </Card>
    <div class="contain" ref="mybox">
      <canvas id="myCanvas" width="200" height="100" ref="myCanvas" style="position: absolute;"></canvas>
    </div>
  </div>
</template>

<script>
import util from "../../../util/util";
import { drawSign } from '../../../util/drawSign';
import { exportFile } from "../../../util/util";
export default {
  props: {
    payWayList: {
      type: Array
    }
  },
  data() {
    const validatePremium = (rule, value, callback) => {
      if (value) {
        let reg = /^[0-9][0-9]*$/;
        let reg1 = /^(([0-9]{1}\d*)|(0{1}))(\.\d{1})$/;
        let reg2 = /^(([0-9]{1}\d*)|(0{1}))(\.\d{2})$/;
        if (reg.test(value)) {
          callback();
        } else if (reg1.test(value)) {
          callback();
        } else if (reg2.test(value)) {
          callback();
        } else {
          callback(new Error("请输入两位小数"));
        }
      } else {
        callback();
      }
      callback();
    };
    const validateMinDay = (rule, value, callback) => {
      const r = /^-?\d+$/
      if (value && (!r.test(value) || value < -60 || value > 65)) {
        callback(new Error('只可录入“-60”到“65”之间的整数'));
      } else {
        if (this.superviseForm.endTime && value && Number(this.superviseForm.endTime) < Number(value)) {
          callback(new Error('应交日开始天数需小于等于应交日结束天数'));
        } else {
          callback();
        }
      }
    };
    const validateMaxDay = (rule, value, callback) => {
      const r = /^-?\d+$/
      if (value && (!r.test(value) || value < -60 || value > 65)) {
        callback(new Error('只可录入“-60”到“65”之间的整数'));
      } else {
        callback();
      }
    };
    return {
      estimatestateList: [
        { key: "0", value: "可回收" },
        { key: "1", value: "收费困难" },
        { key: "2", value: "不可回收" },
        { key: "3", value: "不确定" },
        { key: "4", value: "无法联系" },
      ],
      superviseForm: {
        faceflag: "",//是否面访20200918 wy
        estimatestate: "",//收费预估20200918 wy
        workStatus: "",
        workPlanRange: ["", ""],
        workEndRange: ["", ""],
        PayableRange: ["", ""],
        saleChannel: "",
        subname: "", //子渠道
        visitresult: "", //是否外呼成功
        evaluateflag: "",//是否上传评鉴表
        appntName: "",
        applyNo: "",
        payCount: "",
        pay: "12",
        organization: "",
        salesName: "",
        payDifficult: "",
        minFee: "",
        maxFee: "",
        reagentOrganization: "",
        reagentName: [],
        contMark: "",
        shouldPayRange: ["", ""],
        beginTime: null,
        endTime: null,
        payWay: '',
      },
      rules: {
        minFee: [{ validator: validatePremium, trigger: "blur" }],
        maxFee: [{ validator: validatePremium, trigger: "blur" }],
        beginTime: [{ validator: validateMinDay, trigger: "blur" }],
        endTime: [{ validator: validateMaxDay, trigger: "blur" }]
      },
      //本月交费完成
      difficult: 0,
      nopay: 0,
      pay: 0,
      willInvalid: 0,
      //工作状态下拉框
      workStatusList: [],
      //销售渠道下拉框
      saleChannelList: [],
      // 子渠道下拉框
      subnameList: [],
      //年交
      payList: [],
      // 续期专员机构
      reagentOrganizationList: [],
      // 续期专员姓名
      reagentNameList: [],
      organizationList: [], //调接口
      // 业务员机构
      organizationAgentList: [],
      //表格
      superviseColumns: [
        // {
        //   type: "selection",
        //   align: "center",
        //   fixed: "left",
        //   width: 60
        // },
        {
          title: "保单号",
          key: "contno",
          width: "190",
          fixed: "left"
        },
        {
          title: "保单标志",
          align: "center",
          key: "plantypename",
          width: "130"
        },
        {
          title: "投保人",
          key: "appntname",
          align: "center",
          width: "110"
        },
        {
          title: "应交日",
          key: "paytodate",
          align: "center",
          width: "130",
          sortable: true,
          sortable: "custom"
        },
        {
          title: "应交次数",
          key: "payCount",
          align: "center",
          width: "100"
        },
        {
          title: "交费难度",
          key: "difficulty",
          align: "center",
          width: "120"
        },
        {
          title: "是否呼出成功",
          key: "visitresult",
          align: "center",
          width: "120"
        },
        {
          title: "应收保费(元)",
          key: "sumprem",
          align: "center",
          width: "150",
          sortable: true,
          sortable: "custom"
        },
        {
          title: "宽限期剩余天数",
          key: "restdays",
          align: "center",
          width: "140"
        },
        {
          title: "计划工作时间",
          key: "appointeddate",
          align: "center",
          width: "150"
        },
        {
          title: "计划工作方式",
          key: "worktypename",
          align: "center",
          minWidth: 160
        },
        {
          title: "续期专员",
          key: "agent",
          align: "center",
          width: "160",
          fixed: "right"
        },
        {
          title: "工作状态",
          key: "planstatename",
          align: "center",
          width: "120",
          slot: "planstatename",
          fixed: "right",
          sortable: "custom"
        },
        {
          title: "渠道",
          key: "saleChannel",
          align: "center",
          width: "120"
        },
        {
          title: "子渠道",
          key: "subChannel",
          align: "center",
          width: "120"
        },
        {
          title: "原因",
          key: "reason",
          align: "center",
          width: "120"
        },
      ],
      superviseData: [],
      but: ["primary", "default", "default", "default", "default", "default"],
      workTypeList: [],
      selection: [],
      selectLength: "0",
      total: "0",
      pageSizeOptions: [5, 10, 15, 20],
      pageIndex: 1,
      pageSize: 10,
      queryLoading: false,
      premorder: 0,
      paytodateorder: 0,
      planstatenameorder: 0,//工作状态排序
      historyObj: null,
      flagIndex: 0,
    };
  },
  methods: {
    // 导出数据
    downLoad() {
      let obj = {
        planstate: this.superviseForm.workStatus ? this.superviseForm.workStatus : null,
        rangeminappointeddate: this.superviseForm.workPlanRange[0] ? this.timeFormat(this.superviseForm.workPlanRange[0]) : null,
        rangemaxappointeddate: this.superviseForm.workPlanRange[1] ? this.timeFormat(this.superviseForm.workPlanRange[1]) : null,
        rangeminfishdate: this.superviseForm.workEndRange[0] ? this.timeFormat(this.superviseForm.workEndRange[0]) : null,
        rangemaxfishdate: this.superviseForm.workEndRange[1] ? this.timeFormat(this.superviseForm.workEndRange[1]) : null,
        rangeminpaytodate: this.superviseForm.PayableRange[0] ? this.timeFormat(this.superviseForm.PayableRange[0]) : null,
        rangemaxpaytodate: this.superviseForm.PayableRange[1] ? this.timeFormat(this.superviseForm.PayableRange[1]) : null,
        rangeminControllerDate: this.superviseForm.shouldPayRange[0] ? this.timeFormat(this.superviseForm.shouldPayRange[0]) : null,
        rangemaxControllerDate: this.superviseForm.shouldPayRange[1] ? this.timeFormat(this.superviseForm.shouldPayRange[1]) : null,
        branchtype: this.superviseForm.saleChannel ? this.superviseForm.saleChannel : null,
        appntname: this.superviseForm.appntName ? this.superviseForm.appntName : null,
        contno: this.superviseForm.applyNo ? this.superviseForm.applyNo : null,
        payyear: this.superviseForm.payCount ? this.superviseForm.payCount : null,
        payintv: this.superviseForm.pay ? this.superviseForm.pay : null,
        agentcom: this.superviseForm.organization ? this.superviseForm.organization[this.superviseForm.organization.length - 1] : null,
        agentname: this.superviseForm.salesName ? this.superviseForm.salesName : null,
        difficulty: this.superviseForm.payDifficult ? this.superviseForm.payDifficult : null,
        rangeminprem: this.superviseForm.minFee ? this.superviseForm.minFee : null,
        rangemaxprem: this.superviseForm.maxFee ? this.superviseForm.maxFee : null,
        reagentcode: this.superviseForm.reagentOrganization ? this.superviseForm.reagentOrganization[this.superviseForm.reagentOrganization.length - 1] : null,
        reagentList: this.superviseForm.reagentName.length > 0 ? this.superviseForm.reagentName : [],
        plantype: this.superviseForm.contMark ? this.superviseForm.contMark : null,
        estimatestate: this.superviseForm.estimatestate ? this.superviseForm.estimatestate : null,//收费预估20200918 wy
        faceflag: this.superviseForm.faceflag ? this.superviseForm.faceflag : null,//是否面访20200918 wy
        visitresult: this.superviseForm.visitresult ? this.superviseForm.visitresult : null,
        evaluateflag: this.superviseForm.evaluateflag ? this.superviseForm.evaluateflag : null,
        subname: this.superviseForm.subname ? this.superviseForm.subname : null,
        index: this.pageIndex,
        pageSize: this.pageSize,
        selecttag: String(this.flagIndex),
        premorder: String(this.premorder),
        paytodateorder: String(this.paytodateorder),
        // planstatenameorder: this.planstatenameorder,//工作状态排序20200918 wy
      };
      console.log(obj);
      exportFile("/scrm-gateway/scrm-uer/api/workDownload/notinvalidDownload", obj);
    },
    // 获取子渠道
    changeSaleChannel(value) {
      this.superviseForm.organization = ''
      $.ajax("scrm-gateway/scrm-uer/api/plan/selectsubchannel/" + value, {
        method: "get",
        contentType: "application/json;charset=utf-8",
        headers: {
          Authorization: sessionStorage.getItem("credentials")
        },
        success: res => {
          if (res.code == 200 && res.data != null) {
            let obj = {}
            res.data = res.data.reduce((cur, next) => {
              obj[next.value] ? "" : obj[next.value] = true && cur.push(next);
              return cur;
            }, [])
            this.subnameList = res.data
          } else {
            this.subnameList = [];
          }
        },
        error: res => {
          this.$Message.error(res.msg);
        }
      });
      this.getAgentList(value);
    },
    //转时间
    timeFormat(time) {
      if (!time) {
        return ''
      }
      let d = new Date(time)
      var y = d.getFullYear();
      var m = d.getMonth() + 1;
      if (m < 10) {
        m = "0" + m;
      }
      var day = d.getDate();
      if (day < 10) {
        day = "0" + day;
      }
      return y + "-" + m + "-" + day;
    },
    //行样式
    rowClassName(row, index) {
      if (index > 6) return 'table-row-red1';
      else return ''
      // if (row.facerecordflag == '0' && row.planstatename != '已完成') {
      //   return 'table-row-red1';
      // } else if (row.visitflag == '0' && row.planstatename != '已完成') {
      //   return 'table-row-orange1';
      // }
      // return '';
    },
    // 应交日时间段
    changePayableRange(date) {
      // console.log(date)
      this.superviseForm.PayableRange = date;
    },

    // 工作计划时间段
    changeWorkPlanRange(date) {
      // console.log(date)
      this.superviseForm.workPlanRange = date;
    },

    // 工作完成时间段
    changeWorkEndRange(date) {
      // console.log(date)
      this.superviseForm.workEndRange = date;
    },

    // 工作录入时间段
    changeShouldPayRange(date) {
      // console.log(date)
      this.superviseForm.shouldPayRange = date;
    },

    // 工作统计下拉框信息
    initial() {
      this.api.selectworkplanValid().then(res => {
        res.data = {
          "willInvalid": 1,
          "nopay": 20,
          "pay": 3,
          "difficult": 0
        }
        if (res.code == 200 && res.data != null) {
          this.difficult = res.data.difficult;
          this.nopay = res.data.nopay;
          this.pay = res.data.pay;
          this.willInvalid = res.data.willInvalid;
        }
      });
      this.api.professionalList().then(res => {
        if (res.code == 200 && res.data != null) {
          if (res.data.planListVOS) {
            this.workStatusList = res.data.planListVOS;
          }
          if (res.data.salechnlListVOS) {
            this.saleChannelList = res.data.salechnlListVOS;
          }
          if (res.data.listKeyValueVOS) {
            this.reagentOrganizationList = res.data.listKeyValueVOS;
            this.organizationList = res.data.listKeyValueVOS;
            this.organizationAgentList = res.data.listKeyValueVOS;
          }
          if (res.data.payintvVOS) {
            this.payList = res.data.payintvVOS;
          }
        } else {
          this.reagentorganizationList = [];
          this.organizationList = [];
          this.organizationAgentList = [];
          this.workStatusList = [];
          this.saleChannelList = [];
          this.payList = [];
        }
        //console.log(res);
      });
    },

    //表单---保单金额排序asc
    sortChange(column, key, order) {
      if (column.key == "paytodate") {
        this.premorder = 0;
        this.planstatenameorder = 0;
        // 应交日
        if (column.order == "asc") {
          // 升序
          this.paytodateorder = 1;
        } else if (column.order == "desc") {
          // 降序
          this.paytodateorder = 2;
        } else {
          // 默认
          this.paytodateorder = 0;
        }
      }
      if (column.key == "sumprem") {
        this.paytodateorder = 0;
        this.planstatenameorder = 0;
        // 应收保费
        if (column.order == "asc") {
          // 升序
          this.premorder = 1;
        } else if (column.order == "desc") {
          // 降序
          this.premorder = 2;
        } else {
          // 默认
          this.premorder = 0;
        }
      }
      //工作状态排序
      if (column.key == "planstatename") {
        this.paytodateorder = 0;
        this.premorder = 0;
        // 应收保费
        if (column.order == "asc") {
          // 升序
          this.planstatenameorder = 1;
          this.premorder = 4;
        } else if (column.order == "desc") {
          // 降序
          this.planstatenameorder = 2;
          this.premorder = 3;
        } else {
          // 默认
          this.planstatenameorder = 0;
        }
      }

      this.handleSubmit(this.flagIndex, 999);
      // console.log(column, key, order);
    },

    // 根据管理机构查询所有续期人员
    organizationChange(value) {
      if (!value) {
        this.reagentNameList = [];
      } else {
        $.ajax("scrm-gateway/scrm-uer/api/List/sekectreangencode/" + value[value.length - 1], {
          method: "get",
          contentType: "application/json;charset=utf-8",
          headers: {
            Authorization: sessionStorage.getItem("credentials")
          },
          success: res => {
            if (res.code == 200 && res.data != null) {
              this.reagentNameList = res.data;
            } else {
              this.reagentNameList = [];
            }
          },
          error: res => {
            this.$Message.error(res.msg);
          }
        });
      }
    },

    //点击按钮变绿，其他default
    clickButton(index) {
      let arr = [
        "default",
        "default",
        "default",
        "default",
        "default",
        "default"
      ];
      arr[index] = "primary";
      this.but = arr;
      this.flagIndex = index;
      this.handleSubmit(999);
    },

    // 表格选中
    selectionChange(selection) {
      this.selection = selection;
      this.selectLength = selection.length;
    },

    // 跳转
    forward(row) {
      // console.log(row);
      // console.log(this.pageObj.rangeminpaytodate)
      //session直接存时间进去可能会改变时区
      this.pageObj.rangeminappointeddate = this.timeFormat(this.pageObj.rangeminappointeddate)
      this.pageObj.rangemaxappointeddate = this.timeFormat(this.pageObj.rangemaxappointeddate)
      this.pageObj.rangeminfishdate = this.timeFormat(this.pageObj.rangeminfishdate)
      this.pageObj.rangemaxfishdate = this.timeFormat(this.pageObj.rangemaxfishdate)
      this.pageObj.rangeminpaytodate = this.timeFormat(this.pageObj.rangeminpaytodate)
      this.pageObj.rangemaxpaytodate = this.timeFormat(this.pageObj.rangemaxpaytodate)
      this.pageObj.rangeminControllerDate = this.timeFormat(this.pageObj.rangeminControllerDate)
      this.pageObj.rangemaxControllerDate = this.timeFormat(this.pageObj.rangemaxControllerDate)

      sessionStorage.setItem("QUERYOBJ", JSON.stringify(this.pageObj));
      sessionStorage.setItem("QUERYFORM", JSON.stringify(this.superviseForm));
      sessionStorage.setItem("INSURANCE_TYPE2", "未失效");
      this.$router.push({
        // name: "serviceDetail",
        path: "serviceDetail",
        query: {
          row: row,
          insuranceType: "invalid"
        }
      });
    },

    // 分页设置
    pageChange(pageIndex) {
      this.pageIndex = pageIndex;
      this.pageSubmit();
    },
    pageSizeChange(pageSize) {
      this.pageSize = pageSize;
      this.pageSubmit();
    },

    // 重置
    handleReset() {
      this.$refs.superviseForm.resetFields();
      this.superviseForm = {
        workStatus: "",
        workPlanRange: ["", ""],
        workEndRange: ["", ""],
        PayableRange: ["", ""],
        saleChannel: "",
        subname: "",
        visitresult: "",
        evaluateflag: "",
        appntName: "",
        applyNo: "",
        payCount: "",
        pay: "",
        organization: "",
        salesName: "",
        payDifficult: "",
        minFee: "",
        maxFee: "",
        reagentOrganization: "",
        reagentName: [],
        contMark: "",
        shouldPayRange: ["", ""],
        payWay: '',
      };
    },

    // 提交表单
    handleSubmit(index) {
      this.$refs.superviseForm.validate(valid => {
        if (valid) {
          // console.log(this.superviseForm)
          if (util.formNullValidate(this.superviseForm)) {
            this.$Message.info("至少选择一个条件");
            return false;
          }
          if (this.historyObj == null) {
            if (index >= 0) {
            } else {
              let arr = [
                "default",
                "default",
                "default",
                "default",
                "default",
                "default"
              ];
              arr[0] = "primary";
              this.but = arr;
              this.queryLoading = true;
              this.pageIndex = 1;
            }
          }
          let obj = {
            planstate: this.superviseForm.workStatus
              ? this.superviseForm.workStatus
              : null,
            rangeminappointeddate: this.superviseForm.workPlanRange[0] ? this.timeFormat(this.superviseForm.workPlanRange[0]) : null,
            rangemaxappointeddate: this.superviseForm.workPlanRange[1] ? this.timeFormat(this.superviseForm.workPlanRange[1]) : null,
            rangeminfishdate: this.superviseForm.workEndRange[0] ? this.timeFormat(this.superviseForm.workEndRange[0]) : null,
            rangemaxfishdate: this.superviseForm.workEndRange[1] ? this.timeFormat(this.superviseForm.workEndRange[1]) : null,
            rangeminpaytodate: this.superviseForm.PayableRange[0] ? this.timeFormat(this.superviseForm.PayableRange[0]) : null,
            rangemaxpaytodate: this.superviseForm.PayableRange[1] ? this.timeFormat(this.superviseForm.PayableRange[1]) : null,
            rangeminControllerDate: this.superviseForm.shouldPayRange[0] ? this.timeFormat(this.superviseForm.shouldPayRange[0]) : null,
            rangemaxControllerDate: this.superviseForm.shouldPayRange[1] ? this.timeFormat(this.superviseForm.shouldPayRange[1]) : null,
            branchtype: this.superviseForm.saleChannel
              ? this.superviseForm.saleChannel
              : null,
            appntname: this.superviseForm.appntName
              ? this.superviseForm.appntName
              : null,
            contno: this.superviseForm.applyNo
              ? this.superviseForm.applyNo
              : null,
            payyear: this.superviseForm.payCount
              ? this.superviseForm.payCount
              : null,
            payintv: this.superviseForm.pay ? this.superviseForm.pay : null,
            agentcom: this.superviseForm.organization
              ? this.superviseForm.organization[this.superviseForm.organization.length - 1]
              : null,
            agentname: this.superviseForm.salesName
              ? this.superviseForm.salesName
              : null,
            difficulty: this.superviseForm.payDifficult
              ? this.superviseForm.payDifficult
              : null,
            rangeminprem: this.superviseForm.minFee
              ? this.superviseForm.minFee
              : null,
            rangemaxprem: this.superviseForm.maxFee
              ? this.superviseForm.maxFee
              : null,
            reagentcode: this.superviseForm.reagentOrganization
              ? this.superviseForm.reagentOrganization[this.superviseForm.reagentOrganization.length - 1]
              : null,
            reagentList:
              this.superviseForm.reagentName.length > 0
                ? this.superviseForm.reagentName + ""
                : null,
            plantype: this.superviseForm.contMark
              ? this.superviseForm.contMark
              : null,
            estimatestate: this.superviseForm.estimatestate ? this.superviseForm.estimatestate : null,//收费预估20200918 wy
            faceflag: this.superviseForm.faceflag ? this.superviseForm.faceflag : null,//是否面访20200918 wy
            visitresult: this.superviseForm.visitresult ? this.superviseForm.visitresult : null,
            evaluateflag: this.superviseForm.evaluateflag ? this.superviseForm.evaluateflag : null,
            subname: this.superviseForm.subname ? this.superviseForm.subname : null,
            index: this.pageIndex,
            pageSize: this.pageSize,
            selecttag: this.flagIndex,
            premorder: this.premorder,
            paytodateorder: this.paytodateorder,
            payintv: this.superviseForm.payWay ? this.superviseForm.payWay : null,
            // planstatenameorder: this.planstatenameorder,//工作状态排序20200918 wy

          };
          this.superviseForm.endTime && (obj.endTime = this.superviseForm.endTime)
          this.superviseForm.beginTime && (obj.beginTime = this.superviseForm.beginTime)
          this.pageObj = obj;
          this.api.selectWorkStatisticsValid(obj).then(res => {
            res.data = {
              "records": [
                {
                  "saleChannel": "个险",
                  "subChannel": "直销业务",
                  "reason": null,
                  "visitresult": null,
                  "feewill": null,
                  "failresult": null,
                  "contno": "0000530316861888",
                  "planid": "1356845467581931522",
                  "agentcode": "61000811",
                  "plantypename": "在职单",
                  "appntname": "阙N5",
                  "appntno": "0000250149",
                  "paytodate": "2020-07-19 00:00:00",
                  "payintv": "年交",
                  "payyear": 4,
                  "payyears": 10,
                  "sumprem": 4500,
                  "difficulty": "0",
                  "restdays": 0,
                  "appointeddate": null,
                  "worktypename": null,
                  "reagentcode": "860100003",
                  "planstatename": "已完成",
                  "reagentname": "奚续收",
                  "isassaginment": "2",
                  "visitflag": "0",
                  "facerecordflag": "1",
                  "ccBoList": null
                },
                {
                  "saleChannel": "网销",
                  "subChannel": "i云保",
                  "reason": "续保，宽限期末交费",
                  "visitresult": "是",
                  "feewill": null,
                  "failresult": null,
                  "contno": "0000535720271998",
                  "planid": "1471350302988943362",
                  "agentcode": "E090055",
                  "plantypename": "孤儿单",
                  "appntname": "享九投",
                  "appntno": "0000894932",
                  "paytodate": "2021-12-10 00:00:00",
                  "payintv": "年交",
                  "payyear": 1,
                  "payyears": 10,
                  "sumprem": 10000,
                  "difficulty": "0",
                  "restdays": 9999334,
                  "appointeddate": "2021-12-15 00:00:00",
                  "worktypename": "面访客户",
                  "reagentcode": "860100027",
                  "planstatename": "未服务",
                  "reagentname": "U享续期CC零一组二号",
                  "isassaginment": "2",
                  "visitflag": "0",
                  "facerecordflag": "1",
                  "ccBoList": null
                },
                {
                  "saleChannel": "网销",
                  "subChannel": "i云保",
                  "reason": "拒绝回访",
                  "visitresult": "否",
                  "feewill": null,
                  "failresult": null,
                  "contno": "0000535520921998",
                  "planid": "1471720681599242242",
                  "agentcode": "E090055",
                  "plantypename": "孤儿单",
                  "appntname": "享七投",
                  "appntno": "0000894928",
                  "paytodate": "2021-12-10 00:00:00",
                  "payintv": "年交",
                  "payyear": 1,
                  "payyears": 10,
                  "sumprem": null,
                  "difficulty": "0",
                  "restdays": 0,
                  "appointeddate": null,
                  "worktypename": null,
                  "reagentcode": "860100026",
                  "planstatename": "已完成",
                  "reagentname": "U享续期CC零一组一号",
                  "isassaginment": "2",
                  "visitflag": "0",
                  "facerecordflag": "0",
                  "ccBoList": null
                },
                {
                  "saleChannel": "网销",
                  "subChannel": "i云保",
                  "reason": "",
                  "visitresult": "否",
                  "feewill": null,
                  "failresult": null,
                  "contno": "0000535920591998",
                  "planid": "1473565467071287298",
                  "agentcode": "E090055",
                  "plantypename": "孤儿单",
                  "appntname": "享十一投",
                  "appntno": "0000894936",
                  "paytodate": "2022-12-15 00:00:00",
                  "payintv": "年交",
                  "payyear": 1,
                  "payyears": 10,
                  "sumprem": null,
                  "difficulty": "0",
                  "restdays": 9999334,
                  "appointeddate": "2021-12-22 00:00:00",
                  "worktypename": "电话联系客户",
                  "reagentcode": "860100027",
                  "planstatename": "未服务",
                  "reagentname": "U享续期CC零一组二号",
                  "isassaginment": "2",
                  "visitflag": "0",
                  "facerecordflag": "0",
                  "ccBoList": null
                },
                {
                  "saleChannel": "网销",
                  "subChannel": "明亚",
                  "reason": null,
                  "visitresult": null,
                  "feewill": null,
                  "failresult": null,
                  "contno": "0000029521031998",
                  "planid": "1473840162966437889",
                  "agentcode": "E090055",
                  "plantypename": "孤儿单",
                  "appntname": "齐洋洋",
                  "appntno": "0000874342",
                  "paytodate": "2022-05-25 00:00:00",
                  "payintv": "年交",
                  "payyear": 2,
                  "payyears": 10,
                  "sumprem": 2500,
                  "difficulty": "0",
                  "restdays": 0,
                  "appointeddate": null,
                  "worktypename": null,
                  "reagentcode": "860100026",
                  "planstatename": "已完成",
                  "reagentname": "U享续期CC零一组一号",
                  "isassaginment": "2",
                  "visitflag": "0",
                  "facerecordflag": "1",
                  "ccBoList": null
                },
                {
                  "saleChannel": "网销",
                  "subChannel": "i云保",
                  "reason": "",
                  "visitresult": "是",
                  "feewill": null,
                  "failresult": null,
                  "contno": "0000539220051998",
                  "planid": "1474258442080305153",
                  "agentcode": "E090055",
                  "plantypename": "孤儿单",
                  "appntname": "呼叫二十四女",
                  "appntno": "0000895010",
                  "paytodate": "2022-12-15 00:00:00",
                  "payintv": "年交",
                  "payyear": 1,
                  "payyears": 10,
                  "sumprem": null,
                  "difficulty": "0",
                  "restdays": 9999334,
                  "appointeddate": "2021-12-24 00:00:00",
                  "worktypename": "面访客户",
                  "reagentcode": "860100026",
                  "planstatename": "未服务",
                  "reagentname": "U享续期CC零一组一号",
                  "isassaginment": "2",
                  "visitflag": "0",
                  "facerecordflag": "0",
                  "ccBoList": null
                },
                {
                  "saleChannel": "网销",
                  "subChannel": "i云保",
                  "reason": "",
                  "visitresult": "是",
                  "feewill": null,
                  "failresult": null,
                  "contno": "0000536820091998",
                  "planid": "1474259426978381826",
                  "agentcode": "E090055",
                  "plantypename": "孤儿单",
                  "appntname": "享二十投",
                  "appntno": "0000894954",
                  "paytodate": "2022-12-15 00:00:00",
                  "payintv": "年交",
                  "payyear": 1,
                  "payyears": 10,
                  "sumprem": null,
                  "difficulty": "0",
                  "restdays": 9999337,
                  "appointeddate": "2021-12-24 00:00:00",
                  "worktypename": "电话联系客户",
                  "reagentcode": "860100026",
                  "planstatename": "未服务",
                  "reagentname": "U享续期CC零一组一号",
                  "isassaginment": "2",
                  "visitflag": "0",
                  "facerecordflag": "0",
                  "ccBoList": null
                },
                {
                  "saleChannel": "网销",
                  "subChannel": "i云保",
                  "reason": "不续保",
                  "visitresult": "是",
                  "feewill": null,
                  "failresult": null,
                  "contno": "0000536120911998",
                  "planid": "1474657130854322178",
                  "agentcode": "E090055",
                  "plantypename": "孤儿单",
                  "appntname": "享十三投",
                  "appntno": "0000894940",
                  "paytodate": "2022-12-15 00:00:00",
                  "payintv": "年交",
                  "payyear": 1,
                  "payyears": 10,
                  "sumprem": null,
                  "difficulty": "0",
                  "restdays": 9999334,
                  "appointeddate": "2021-12-25 00:00:00",
                  "worktypename": "电话联系客户",
                  "reagentcode": "860100028",
                  "planstatename": "未服务",
                  "reagentname": "U享续期CC零一组三号",
                  "isassaginment": "2",
                  "visitflag": "0",
                  "facerecordflag": "0",
                  "ccBoList": null
                },
                {
                  "saleChannel": "网销",
                  "subChannel": "i云保",
                  "reason": "",
                  "visitresult": "是",
                  "feewill": null,
                  "failresult": null,
                  "contno": "0000536020751998",
                  "planid": "1474658676136579074",
                  "agentcode": "E090055",
                  "plantypename": "孤儿单",
                  "appntname": "享十二投",
                  "appntno": "0000894938",
                  "paytodate": "2022-12-15 00:00:00",
                  "payintv": "年交",
                  "payyear": 1,
                  "payyears": 10,
                  "sumprem": null,
                  "difficulty": "0",
                  "restdays": 9999334,
                  "appointeddate": "2021-12-25 00:00:00",
                  "worktypename": "短信联系客户",
                  "reagentcode": "860100028",
                  "planstatename": "未服务",
                  "reagentname": "U享续期CC零一组三号",
                  "isassaginment": "2",
                  "visitflag": "0",
                  "facerecordflag": "0",
                  "ccBoList": null
                },
                {
                  "saleChannel": "网销",
                  "subChannel": "i云保",
                  "reason": "无人接听/无法接通/关机/停机",
                  "visitresult": "否",
                  "feewill": null,
                  "failresult": null,
                  "contno": "0000536220101998",
                  "planid": "1474658734982664194",
                  "agentcode": "E090055",
                  "plantypename": "孤儿单",
                  "appntname": "享十四投",
                  "appntno": "0000894942",
                  "paytodate": "2022-12-15 00:00:00",
                  "payintv": "年交",
                  "payyear": 1,
                  "payyears": 10,
                  "sumprem": null,
                  "difficulty": "0",
                  "restdays": 9999334,
                  "appointeddate": "2021-12-25 00:00:00",
                  "worktypename": "面访客户",
                  "reagentcode": "860100028",
                  "planstatename": "未服务",
                  "reagentname": "U享续期CC零一组三号",
                  "isassaginment": "2",
                  "visitflag": "0",
                  "facerecordflag": "0",
                  "ccBoList": null
                }
              ],
              "total": "10",
              "size": "10",
              "current": "1",
              "orders": [],
              "searchCount": true,
              "pages": "1"
            }
            if (res.code == 200 && res.data != null) {
              this.queryLoading = false;
              this.historyObj = null;
              if (res.data.records && res.data.total > 0) {
                this.total = res.data.total;
                this.superviseData = res.data.records;
                this.superviseData.forEach(element => {
                  if (element.paytodate) {
                    element.paytodate = element.paytodate.substr(0, 10);
                  }
                  if (element.payyear && element.payyears && element.payintv) {
                    element.payintvname = element.payintv
                    element.payCount =
                      element.payyear +
                      "/" +
                      element.payyears +
                      element.payintv;
                  }
                  if (element.appointeddate) {
                    element.appointeddate = element.appointeddate.substr(0, 10);
                  }
                  if (element.reagentcode && element.reagentname) {
                    element.agent =
                      element.reagentname + "-" + element.reagentcode;
                  }
                });
                if (index != 999) {
                  this.$Message.info(res.msg);
                }
              } else {
                this.total = 0;
                this.superviseData = []
                this.$Message.info("查询数据为空");
              }
            } else {
              this.queryLoading = false;
              this.total = 0;
              this.superviseData = [];
              this.$Message.info(res.msg);
            }
          });
        } else {
          this.$Message.error("信息填写有误");
        }
      });
    },

    // 分页查询
    pageSubmit() {
      this.pageObj.index = this.pageIndex;
      this.pageObj.pageSize = this.pageSize;
      this.api.selectWorkStatisticsValid(this.pageObj).then(res => {
        if (res.code == 200 && res.data != null) {
          this.queryLoading = false;
          if (res.data.records && res.data.total > 0) {
            this.total = res.data.total;
            this.superviseData = res.data.records;
            this.superviseData.forEach(element => {
              if (element.paytodate) {
                element.paytodate = element.paytodate.substr(0, 10);
              }
              if (element.payyear && element.payyears && element.payintv) {
                element.payintvname = element.payintv
                element.payCount =
                  element.payyear + "/" + element.payyears + element.payintv;
              }
              if (element.appointeddate) {
                element.appointeddate = element.appointeddate.substr(0, 10);
              }
              if (element.reagentcode && element.reagentname) {
                element.agent = element.reagentname + "-" + element.reagentcode;
              }
            });
          } else {
            this.total = 0;
            this.superviseData = [];
            this.$Message.info("查询数据为空");
          }
        } else {
          this.queryLoading = false;
          this.total = 0;
          this.superviseData = [];
          this.$Message.info(res.msg);
        }
      });
    },

    // 转化为两位小数
    decimalConversion(value) {
      let reg = /^[0-9][0-9]*$/;
      let reg1 = /^(([0-9]{1}\d*)|(0{1}))(\.\d{1})$/;
      let reg2 = /^(([0-9]{1}\d*)|(0{1}))(\.\d{2})$/;
      if (value) {
        if (reg.test(value)) {
          this.superviseForm.minFee = value + ".00";
        } else if (reg1.test(value)) {
          this.superviseForm.minFee = value + "0";
        } else if (reg2.test(value)) {
        } else {
          this.$refs.superviseForm.validateField("minFee");
        }
      } else {
        this.superviseForm.minFee = null;
      }
    },

    decimalConversion2(value) {
      let reg = /^[0-9][0-9]*$/;
      let reg1 = /^(([0-9]{1}\d*)|(0{1}))(\.\d{1})$/;
      let reg2 = /^(([0-9]{1}\d*)|(0{1}))(\.\d{2})$/;
      if (value) {
        if (reg.test(value)) {
          this.superviseForm.maxFee = value + ".00";
        } else if (reg1.test(value)) {
          this.superviseForm.maxFee = value + "0";
        } else if (reg2.test(value)) {
        } else {
          this.$refs.superviseForm.validateField("maxFee");
        }
      } else {
        this.superviseForm.maxFee = null;
      }
    },
    draw(ele, loginUser, loginTime) {
      let imageUrl = drawSign(ele, loginUser, loginTime)
      document.getElementsByClassName("ivu-table-fixed-body")[0].style.background = 'url(' + imageUrl + ') left top repeat'
      document.getElementsByClassName("ivu-table-fixed-body")[0].classList.add("add-background")

      document.getElementsByClassName("ivu-table-fixed-body")[1].style.background = 'url(' + imageUrl + ') left top repeat'
      document.getElementsByClassName("ivu-table-fixed-body")[1].classList.add("add-background")

      document.getElementsByClassName("ivu-table-body")[0].style.background = 'url(' + imageUrl + ') left top repeat'
      document.getElementsByClassName("ivu-table-body")[0].classList.add("add-background")
    },
    //获取业务员机构下拉框
    getAgentList(value) {
      this.api.getagentList({ branchtype: value ? value : '' }).then(res => {
        if (res.code == 200 && res.data != null) {
          let arr = []
          arr = res.data
          arr.forEach(one => {
            one.value = one.comcode
            one.label = one.comcode + '-' + one.name
            one.children = one.chilDren || []
            if (one.children && one.children.length > 0) {
              one.chilDren.forEach(two => {
                two.value = two.comcode
                two.label = two.comcode + '-' + two.name
                two.children = two.chilDren || []
                if (two.children && two.children.length > 0) {
                  two.children.forEach(three => {
                    three.value = three.comcode
                    three.label = three.comcode + '-' + three.name
                    three.children = three.chilDren || []
                    if (three.children && three.children.length > 0) {
                      three.children.forEach(four => {
                        four.value = four.comcode
                        four.label = four.comcode + '-' + four.name
                        four.children = four.chilDren || []
                      })
                    }
                  })
                }
              })
            }
          })
          console.log(arr);
          this.organizationAgentList = arr
        } else {
          this.organizationAgentList = [];
        }
      });
    },
    getOrganization() {
      this.api.remanagecomList().then(res => {
        if (res.code == 200 && res.data != null) {
          let arr = []
          arr.push(res.data)
          arr.forEach(one => {
            one.value = one.comcode
            one.label = one.comcode + '-' + one.name
            one.children = one.chilDren || []
            if (one.children) {
              one.chilDren.forEach(two => {
                two.value = two.comcode
                two.label = two.comcode + '-' + two.name
                two.children = two.chilDren || []
                if (two.children) {
                  two.children.forEach(three => {
                    three.value = three.comcode
                    three.label = three.comcode + '-' + three.name
                    three.children = three.chilDren || []
                    if (three.children) {
                      three.children.forEach(four => {
                        four.value = four.comcode
                        four.label = four.comcode + '-' + four.name
                        four.children = four.chilDren || []
                      })
                    }
                  })
                }
              })
            }
          })
          console.log(arr);
          this.organizationList = arr
        } else {
          this.organizationList = [];
        }
      });
    }
  },
  created() {
    if (sessionStorage.getItem("INSURANCE_TYPE2") == "未失效") {
      if (sessionStorage.getItem("QUERYOBJ")) {
        // 二次筛选条件
        this.historyObj = JSON.parse(sessionStorage.getItem("QUERYOBJ"));
        this.flagIndex = this.historyObj.selecttag;
        this.premorder = this.historyObj.premorder;
        this.paytodateorder = this.historyObj.paytodateorder;
        console.log(this.historyObj, 'this.historyObj')
        let arr = [
          "default",
          "default",
          "default",
          "default",
          "default",
          "default"
        ];
        arr[this.flagIndex] = "primary";
        this.but = arr;
        this.pageIndex = this.historyObj.index;
        this.pageSize = this.historyObj.pageSize;

        // 单次查询条件
        this.superviseForm = JSON.parse(sessionStorage.getItem("QUERYFORM"));
        // 工作录入时间段
        this.superviseForm.shouldPayRange[0] = this.historyObj.rangeminControllerDate;
        this.superviseForm.shouldPayRange[1] = this.historyObj.rangemaxControllerDate;
        // 工作计划时间段
        this.superviseForm.workPlanRange[0] = this.historyObj.rangeminappointeddate;
        this.superviseForm.workPlanRange[1] = this.historyObj.rangemaxappointeddate;
        // 工作完成时间段
        this.superviseForm.workEndRange[0] = this.historyObj.rangeminfishdate;
        this.superviseForm.workEndRange[1] = this.historyObj.rangemaxfishdate;
        // 应交日时间段
        this.superviseForm.PayableRange[0] = this.historyObj.rangeminpaytodate;
        this.superviseForm.PayableRange[1] = this.historyObj.rangemaxpaytodate;

        this.organizationChange(this.superviseForm.reagentOrganization);
        console.log(this.historyObj, this.superviseForm, '8888');

        // this.handleSubmit(999);

        sessionStorage.removeItem("QUERYOBJ");
        sessionStorage.removeItem("QUERYFORM");
        // sessionStorage.removeItem("INSURANCE_TYPE2");
      }
    }
  },
  mounted() {

    this.getAgentList(this.superviseForm.saleChannel || '')
    this.superviseForm.saleChannel && this.changeSaleChannel(this.superviseForm.saleChannel)
    this.getOrganization()
    console.log(sessionStorage.getItem("INSURANCE_TYPE2"), sessionStorage.getItem("QUERYOBJ"), '456788');

    this.initial();
    if (this.historyObj) {
      this.handleSubmit(999)
    }
    let loginUser = sessionStorage.getItem("name");
    let loginTime =
      new Date().getFullYear() +
      "/" +
      (new Date().getMonth() + 1) +
      "/" +
      (new Date().getDate());
    this.draw(this.$refs.myCanvas, loginUser, loginTime)
  },
  beforeDestroy() {
    this.superviseData = null
  }
};
</script>
<style lang="less">
@import "./index.less";

.ivu-modal-header {
  background-color: #2d8cf0;
}

.ivu-modal-close .ivu-icon-ios-close {
  color: #fff;
}

.add-background td {
  background-color: rgba(255, 255, 255, 0) !important;
  background: rgba(255, 255, 255, 0) !important;
}
</style>
